package com.redijedi.tapestry.internal.tree;

import java.util.ArrayList;
import java.util.Collection;

import com.redijedi.tapestry.ITreeNodeModel;
import com.redijedi.tapestry.IVisitor;

/**
 * @author torr
 * 
 */
public abstract class AbstractTreeNodeModel<T> implements ITreeNodeModel<T> {

	protected ITreeNodeModel<T> _parent;

	protected Collection<ITreeNodeModel<T>> _children = new ArrayList<ITreeNodeModel<T>>();

	protected T _value;

	protected boolean _display = false;

	public void accept(IVisitor visitor) {
		// performs the visit on this node
		visitor.visit(this);
	}

	public Collection<ITreeNodeModel<T>> getChildren() {
		return _children;
	}

	public ITreeNodeModel<T> getParent() {
		return _parent;
	}

	public T getValue() {
		return _value;
	}

	public boolean display() {
		return _display;
	}

}
